home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / devel / vbcc-src / vbpp.h < prev   
C/C++ Source or Header  |  1999-01-01  |  4KB  |  90 lines

  1. #ifndef _VBPP_H
  2. #define _VBPP_H 1
  3.  
  4. /* vbpp.h
  5.  * last change: 17.08.1995 Thorsten Schaaps
  6.  */
  7.  
  8. /* strnode-types */
  9. #define NORMAL      0          /* anything: brackets,+,-,/,*, etc.. */
  10. #define PP_IDENT    1          /* possible identifier               */
  11. #define ARGUMENT    2          /* argument: see number              */
  12. #define PP_STR      3          /* strings                           */
  13. #define NUMBER      4          /* numbers (123,0x00,0L,..)          */
  14. #define SPACE       5          /* spaces, tabs, etc.                */
  15. #define SPECIAL     6          /* flags=1->#,flags=2->##            */
  16.  
  17. /* flags for type==SPECIAL */
  18. #define NONE        0
  19. #define TOSTRING    1          /* #define t(c) #c                   */
  20. #define KILLSPACES  2          /* #define t(a,b) a##b               */
  21.  
  22. struct strnode{
  23.   char           *str;         /* the string =8) ah, you guessed that. */
  24.   int             len;         /* the length of the string             */
  25.   int             flags;       /* flags: see above                     */
  26.   int             type;        /* type:  see above                     */
  27.   int             number;      /* only valid if type==ARGUMENT         */
  28.   struct strnode *prev,*next;  /* pointers to previous and next node or NULL */
  29. };
  30.  
  31. /* Macro-Node-Flags */
  32. #define FUNCTION  1     /* for macros changing from line to line, e.g. */
  33.                         /*          __LINE__, __FILE__, __TIME__ etc.. */
  34. #define PARAMETER 2     /* Macro has arguments                         */
  35. #define NODELETE  4     /* Macro cannot be UNDEFined, e.g. __TIME__,   */
  36.                         /*          __DATE__, __STDC__                 */
  37. #define NOREDEF   8     /* Macro cannot be reDEFINED, (s. above, but   */
  38.                         /*          not __STDC__)                      */
  39.  
  40. /* Function-Numbers for FUNCTION-Macros */
  41. #define FUNCLINE  1     /* __LINE__ */
  42. #define FUNCFILE  2     /* __FILE__ */
  43. #define FUNCDATE  3     /* __DATE__ */
  44. #define FUNCTIME  4     /* __TIME__ */
  45.        /* __STDC__ is a normal macro, but cannot be deleted */
  46.  
  47. struct mnode{
  48.   char           *name;       /* name, e.g. SQR                         */
  49.   char           *args;       /* arguments, e.g. (x)                    */
  50.   char           *token;      /* definition as string, e.g. ((x)*(x))   */
  51.                               /* BE CAREFULL: may be NULL in the future */
  52.   struct strnode *tokenlist;  /* definition as list                     */
  53.   int             flags;      /* flags, see above                       */
  54.   int             numargs;    /* number of arguments                    */
  55.   int             funcnum;    /* number of function (see above)         */
  56.   struct mnode   *prev,*next; /* pointers to previos and next node or NULL */
  57. };
  58.  
  59. /* Return-Codes for ExpandList/ExpandArgMakro/CloneArg-Functions */
  60. #define OK            0
  61. #define OUT_OF_MEM   -1
  62. #define NUM_OF_ARGS  -2
  63. #define ARG_EXPECTED -3
  64.  
  65. void            AddMakroNode(struct mnode **, struct mnode *);
  66. void            InsertMakroNode(struct mnode **, struct mnode *, struct mnode *);
  67. void            RemMakroNode(struct mnode **, struct mnode *);
  68. struct mnode   *FindMakroNode(struct mnode *, char *, int);
  69. void            DelMakroNode(struct mnode **, struct mnode *);
  70. void            DelMakroList(struct mnode **);
  71.  
  72. void            AddStrNode(struct strnode **, struct strnode *, char *);
  73. void            RemStrNode(struct strnode **, struct strnode *);
  74. /* struct strnode *FindStrNode(struct strnode *, char *, int); */
  75. void            DelStrNode(struct strnode **, struct strnode *);
  76. void            DelStrList(struct strnode **);
  77. struct strnode *CloneStrList(struct strnode *, struct strnode *);
  78. struct strnode *DoMakroFunction(struct mnode *);
  79.  
  80. struct strnode *Str2List(char *);
  81. int             List2Str(struct strnode *, char *, int);
  82.  
  83. int             ExpandList(struct strnode **);
  84.  
  85. struct mnode   *ParseIdentifier(char *);
  86. int             PreParse(void);
  87.  
  88. #endif
  89.  
  90.